public class ProxyPattern {
    public static void main(String[] args) {
        Subject proxy=new Proxy();
        proxy.something();        
    }
}
interface Subject{
    void something();
}
class RealSubject implements Subject{
    public void something(){
        System.out.println("做事情");
    }
}
class Proxy implements Subject{
    Subject subject;
    public void something(){
        if (subject==null) {
            subject=new RealSubject();
        }
        subject.something();
    }
}